#ifndef METAOBJECTTRANS_H
#define METAOBJECTTRANS_H
#include "ErrorCode.h"
#include "MetaObject.h"

namespace gitstore {

class CObjectCodeTransBase {
protected:
    CObjectCodeTransBase();

public:
    virtual ~CObjectCodeTransBase();

public:
    virtual ErrorStatus encodeObject(const Object& object, std::string &en_string) = 0;
    virtual ErrorStatus decodeObject(Object& object, const std::string &de_string) = 0;
    virtual ErrorStatus encodeBranch(const Branch& branch, std::string &en_string) = 0;
    virtual ErrorStatus decodeBranch(Branch& branch, const std::string &de_string) = 0;
    virtual ErrorStatus encodeNode(const Node& node, std::string &en_string) = 0;
    virtual ErrorStatus decodeNode(Node& node, const std::string &de_string) = 0;
};

class CObjectCodeJsonTrans : public CObjectCodeTransBase {
public:
    CObjectCodeJsonTrans();
    ~CObjectCodeJsonTrans() override;

public:
    virtual ErrorStatus encodeObject(const Object& object, std::string &en_string) override;
    virtual ErrorStatus decodeObject(Object& object, const std::string &de_string) override;
    virtual ErrorStatus encodeBranch(const Branch& branch, std::string &en_string) override;
    virtual ErrorStatus decodeBranch(Branch& branch, const std::string &de_string) override;
    virtual ErrorStatus encodeNode(const Node& node, std::string &en_string) override;
    virtual ErrorStatus decodeNode(Node& node, const std::string &de_string) override;

};

class CObjectCodeBoostSerializationTrans : public CObjectCodeTransBase {
public:
    CObjectCodeBoostSerializationTrans();
    ~CObjectCodeBoostSerializationTrans() override;

public:
    virtual ErrorStatus encodeObject(const Object& object, std::string &en_string) override;
    virtual ErrorStatus decodeObject(Object& object, const std::string &de_string) override;
    virtual ErrorStatus encodeBranch(const Branch& branch, std::string &en_string) override;
    virtual ErrorStatus decodeBranch(Branch& branch, const std::string &de_string) override;
    virtual ErrorStatus encodeNode(const Node& node, std::string &en_string) override;
    virtual ErrorStatus decodeNode(Node& node, const std::string &de_string) override;
};

}
#endif
